package cn.cdeden.knowledge.controller.online.factory.jurisdiction;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @ProjectName : ecm_hou
 * @Package : com.cdyd.ecm.file.jurisdiction
 * @ClassName : JurisdictionResponse
 * @Author : Yu.
 * @Description : // 在线编辑预览下载权限请求返回值
 * @Date : 2022/9/28 17:01
 * @Version : 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class JurisdictionResponse<T> {
    private Boolean state = false ;
    private String message ;
    private String id ;
    private String type ;
    private String name ;
    private String suffix ;
    private String watermarkTxt ;
    private boolean permanent ;
    private T data ;


//    String errorMessge;


    public static JurisdictionResponse success(String id ,String type,String name,String suffix,String watermarkTxt){
        return new JurisdictionResponse(true, messageEnum.SUCCESS_MESSAGE.getKey(),id,type,name,suffix,watermarkTxt,false,null);
    }

    public static JurisdictionResponse success(String id ,String type,String name,String suffix){
        return new JurisdictionResponse(true, messageEnum.SUCCESS_MESSAGE.getKey(),id,type,name,suffix,null,false,null);
    }

    public static JurisdictionResponse success(){
        return new JurisdictionResponse(true, messageEnum.SUCCESS_MESSAGE.getKey(),null,null,null,null,null,false,null);
    }




    public static JurisdictionResponse success(Object data){


        return new JurisdictionResponse(true, messageEnum.SUCCESS_MESSAGE.getKey(),null,null,null,null,null,false,data);
    }


    public static JurisdictionResponse errorResult(String message){
        return new JurisdictionResponse(false, message,null,null,null,null,null,false,null);
    }

    public static JurisdictionResponse errorResult(){
        return new JurisdictionResponse(false, messageEnum.ERROR_MESSAGE.getKey(),null,null,null,null,null,false,null);
    }

    enum messageEnum{

        ERROR_MESSAGE("没权限"),
        SUCCESS_MESSAGE("成功")
        ;
        private final String key;

        messageEnum(String key) {
            this.key = key;
        }

        public String getKey() {
            return key;
        }
    }
}
